﻿
@{
    ViewBag.Title = "出入院登记单";
    Layout = "~/Views/Shared/_Form.cshtml";
}
<div class="rows">
    <div class="panel panel-default">
        <table class="form">
            <tr>
                <th class="formTitle">开始日期：</th>
                <td class="formValue">
                    <input id="kssj" type="text" class="form-control input-wdatepicker form-an"
                           onclick="WdatePicker({ dateFmt: 'yyyy-MM-dd'})" value="@(DateTime.Now.ToString("yyyy-MM-01"))" />
                </td>
                <th class="formTitle">结束日期：</th>
                <td class="formValue">
                    <input id="jssj" type="text" class="form-control input-wdatepicker form-an"
                           onclick="WdatePicker({ dateFmt: 'yyyy-MM-dd'})" value="@(DateTime.Now.ToString("yyyy-MM-dd"))" />
                </td>
                <th class="formTitle">类型：</th>
                <td class="formValue">
                    <select id="type" name="type" class="form-control form-an">
                        <option value="">==请选择==</option>
                        <option value="ry" selected>入院</option>
                        <option value="cy">出院</option>
                    </select>
                </td>
                <th class="formTitle"></th>
                <td class="formValue"></td>
                <td class="formValue" style="padding-left:20px;">
                    <input type="button" id="btn_search" onclick="submit();" class="btn btn-primary btn-md" value="查询" style="width:55px" />
                </td>
            </tr>
        </table>
    </div>
</div>
<div class="ui-layout" id="layout" style="height:100%;width:100%;">
    <iframe class="ui-layout-center" style="width:100%;" id="iframerightiframerightiframerightttt" name="iframerightiframerightiframerightttt"
            scrolling="auto" allowtransparency="true" frameborder="0"></iframe>
</div>
<script type="text/javascript">
    var reportServerHOST = '@(ViewBag.ReportServerHOST)';
    var orgId = '@(ViewBag.OrgId)';
    var thisorgId = '@(ViewBag.OrgId)';
    var curUsergh = '@(ViewBag.curUsergh)';
   
    var uri = '/ReportServer/Pages/ReportViewer.aspx?%2fNewtouch.Report.1%2f出入院登记表&rs:Command=Render';

    $(function () {
        var h = $(window).height() - 55
        $('#layout iframe').css('height', h);
        setTimeout(function () { submit(); }, 100);
    });
    function submit() {
        var url = getUrl();

        var t = $('#type').val();
        if (t) {
            var kssj = $('#kssj').val();
            var jssj = $('#jssj').val();
            if (t == "ry") {
                url += "&rykssj=" + kssj;
                url += "&ryjssj=" + jssj;
            }
            else {
                url += "&cykssj=" + kssj;
                url += "&cyjssj=" + jssj;
            }
        }

        //直接打开
        //location.href = url;
        //return;
        console.log(url);
        setTimeout("$.loading(true, '正在请求报表页面...');", 10);
        $("#iframerightiframerightiframerightttt").attr('src', url);
    }

    $("#iframerightiframerightiframerightttt").load(function () {
        $.loading(false);
    });

    function getUrl() {
        if (uri.StartWith('/')) {
            uri = uri.substr(1);
        }
        var srcUrl = uri;
        srcUrl = reportServerHOST + srcUrl;

        //获取自定义样式
        if (true) {
            if (srcUrl.indexOf('&rc:') == -1) {
                srcUrl += "&rc:Stylesheet=MyStyleSheetBlankPage";
            }
        }
        if (true) {
            if (srcUrl.indexOf('&rs:') == -1) {
                srcUrl += "&rs:";
            }
            else {
                srcUrl += "&";
            }
            srcUrl += "orgId=";
            srcUrl += orgId;
        }
        //if (true) {
        //    if (srcUrl.indexOf('&rs:') == -1) {
        //        srcUrl += "&rs:";
        //    }
        //    else {
        //        srcUrl += "&";
        //    }
        //}
        return srcUrl;
    }
</script>